home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #1 / Amiga Plus 1995 #1.iso / fish-disketten / fish_761-770 / d765 / gambit_comp / build.doc next >
Text File  |  1994-12-13  |  3KB  |  80 lines

  1. FILE:          "build.doc"
  2. IMPLEMENTS:    Description of how to build a stand-alone program (gsi).
  3. AUTHOR:        Ken Dickey
  4. DATE:          1992 August 2
  5. LAST UPDATED:  1992 November 1
  6.  
  7. NOTES:  Lattice/SAS C version 5.04; Amiga 2000 w GVP 68030/882.
  8.         You really should have a hard disk and at least 3MB of RAM.
  9.  
  10. There are 2 versions of gsi which can be built.  The way that uses the
  11. least space loads the runtime from disk (assumed from directory
  12. "Gambit:runtime").  Another way--which is here as gsi--bundles Scheme
  13. binaries with the C code.  This takes up some extra space, but
  14. requires that only 1 file--gsi--be present.  I will first describe the
  15. large version, then the small one.  Note that the make utility I got
  16. with my original Lattice never worked, so I have written a few simple
  17. scripts instead.
  18.  
  19. In either case there are 3 steps to building gsi [0 is already done]:
  20.   [0] Compile the Scheme runtime files into object files.
  21.   [1] Convert the Scheme object files for the interpreter runtime
  22. into C object format.
  23.   [2] Compile the loader (C) sources.
  24.   [3] Link the C objects together into an executable.
  25.  
  26.  
  27. LARGE
  28.  
  29. In addition to compiling the loader C files, you will need to convert
  30. compiled scheme ".O" files to C ".obj" files using "gcv".  Just execute
  31. "gcv foo" to create "foo.obj" from "foo.O".  Use "glk" and the file
  32. names beyond the runtime which may be required.  "glk gsi" creates a
  33. "link_me.c" file--this has already been done for gsi.  
  34.  
  35. You can then use the "link-full" or the "link-full.emu" script to link 
  36. together gsi.  The script for this is "loader/compile-runtime.68020". 
  37.  
  38. Actually, you can link together a stand-alone compiler (gsc), but this
  39. adds about 800K to the binary, so I just load the compiled compiler
  40. files from disk (see "compiler.doc").
  41.  
  42. Example:
  43.  
  44. >> cd Gambit:objects/interpreter
  45. >> gcv _runtime                  ; creates _runtime.obj from _runtime.O
  46. >> gcv _standard
  47. ;; and so on for each for each .O file
  48. >> copy #?.obj //sources/loader  ; copy to loader dir for link
  49. >> cd //sources/loader
  50. >> execute compile-runtime.68020 ; compile the loader files
  51. >> execute link-full             ; link gsi from the C and Scheme objects
  52. >> gsi                           ; check it out ...
  53. >> copy gsi C:gsi                ; put it in your C: directory
  54.  
  55.  
  56. SMALL
  57.  
  58. The loader is built with either the "compile.68020+FPU" or the
  59. "compile.68000+emul" script.  The small system is liked with
  60. "short_link.o" which causes the runtime to be read in from disk.
  61. Use "link-short" or "link-short.emu" to do the link.
  62.  
  63.  
  64.  
  65. LINKING IN C FILES
  66.  
  67. You can link in C files as long as they obey the Gambit runtime
  68. conventions.  C storage should never be referenced by other than a
  69. vector opaque to the garbage collector (see "sources/interpreter/gsi.scm" 
  70. for unscanned-vector implementation and "loader/gambit.h" for
  71. representation usage).  Scheme objects may be moved by the collector
  72. and so references to them from C should not be retained between calls.
  73. Other than that, look at "loader/emu.c" and "loader/ext.c" and
  74. "loader/ext_amiga" for a simple example.  As you can see calling C
  75. from Scheme is pretty darn simple.
  76.  
  77.  
  78. .
  79. ;;                      --- E O F ---
  80.